package com.wxzl.community.common.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter

/**
 * @Author: LiaoZhongKai
 * @Date: 2021/5/26 14:57
 * @Description: TabLayout+Fragment的ViewPager2适配器
 */
class TabFragmentPagerAdapter(activity: FragmentActivity, private val fragments: MutableList<Fragment>) : FragmentStateAdapter(activity) {
    override fun getItemCount(): Int {
        return fragments.size
    }

    override fun createFragment(position: Int): Fragment {
        return fragments[position]
    }

}